SELECT_OPTION_COUNT = 7;

function update_selected_route_instance(courier_id) {
  try {
    select_id = "select_for_" + courier_id;
    selected_date = $(select_id).value;
	if (selected_date == "See More") {
		select_offset_id = "select_offset_for_" + courier_id;
		offset = parseInt($(select_offset_id).value) + SELECT_OPTION_COUNT;
		loc = window.location;
		url = loc.href.split("?")[0];
		url += "?" + select_offset_id + "=" + offset;
		loc.assign(url);
	} else if (selected_date == "Reset List") {
		loc = window.location;
		url = loc.href.split("?")[0];
		loc.assign(url);
	} else {
		$$('.route_instance_for_' + courier_id).each(function(div) { div.hide(); });
		$(courier_id + "_" + selected_date).show();
	}
  }
  catch (err) {
    alert(err);
  }
}
